from Config.cfg import cfg
from Config.cfg.cfgurl import cfg_login_url
from Lib.Base.base_request import request
from Lib.Base.token_api import get_token


class ApiLogin():
    def __init__(self):
        self.method = f'{cfg.api_post}'
        self.url = f'{cfg_login_url.login_api}'
        self.header = get_token()

    def lgin(self, json_params):
        return request.run_main(self.method, self.url, json_params, self.header)


apilogin = ApiLogin()

if __name__ == "__main__":
    header = get_token()

    # # header2 =json.load(header)
    # method = f'{cfg.api_post}'
    # url = f'{cfg_login_url.login_api}'
    # userName = f'{cfg_login_parameter.loginFile_001_userName}'
    # password = f'{cfg_login_parameter.loginFile_001_password}'
    # json_params = {"userName": userName, "password": password}
    # apilogin = ApiLogin()
    # apilogin.lgin(json_params)
